import matplotlib.pyplot as plt
import numpy as np
from matplotlib import rcParams


# 数据可视化增强实现
def enhanced_chinese_plot():
    import matplotlib.pyplot as plt
    import numpy as np

    # 配置中文字体（必须添加）
    plt.rcParams['font.sans-serif'] = ['SimHei']
    plt.rcParams['axes.unicode_minus'] = False

    # 数据准备
    categories = [
        '央视记者采访燕郊爆炸被驱离',
        '新闻学教授怒骂张雪峰',
        '胡锡进谈虐猫事件',
        '巴以冲突',
        '姜萍数学竞赛违规事件'
    ]
    values = [4000, 12000, 10000, 6000, 3000]

    # 绘图代码（保持原样）
    plt.figure(figsize=(12, 8))
    x_pos = np.arange(len(categories))
    bars = plt.bar(x_pos, values, width=0.6)

    for bar in bars:
        height = bar.get_height()
        plt.text(bar.get_x() + bar.get_width() / 2., height, f'{height}', ha='center', va='bottom')

    plt.title('各主题评论数量分布', fontsize=16)
    plt.xticks(x_pos, categories, rotation=30, ha='right')
    plt.grid(axis='y', linestyle='--', alpha=0.7)
    plt.tight_layout()
    plt.show()

if __name__ == '__main__':
    enhanced_chinese_plot()
